add multistore support with mage add store and mage add stores#43
Open
add multistore support with mage add store and mage add stores#43
mage add store and mage add stores#43Conversation
Adds interactive and batch workflows for creating Magento 2 store views
under a Valet local development environment.
New commands:
mage add store — interactive: prompts for code, name, domain, locale;
creates the store view via dev/tools/create-store.php,
sets base URLs, updates .valet-env.php, and runs
valet link + valet secure in one step.
mage add stores — batch: reads dev/tools/stores.json and creates all
defined store views non-interactively; batches all
valet link calls then all valet secure calls to avoid
redundant nginx restarts.
stores.json schema (project-agnostic — domain derived from project name):
{
"stores": [
{ "code": "nl_nl", "name": "Dutch", "suffix": "nl", "locale": "nl_NL" }
]
}
Changes:
src/_multistore.sh (new)
- mage_valet_env_add_entry: appends a store entry to .valet-env.php
using Python 3; skips duplicates safely.
- mage_add_store: single-store interactive flow with auto-lowercase
of store code and input validation.
- mage_add_stores_from_file: batch flow; resolves stores.json from
dev/tools/ -> project root -> mage bin dir; computes domain as
<project-name>-<suffix> so stores.json is project-agnostic.
src/_setup.sh
- Removed hardcoded placeholder store-2 / default2 from mage_setup.
- mage_setup now scaffolds dev/tools/create-store.php and
dev/tools/stores.json from the mage bin directory into every new
project automatically.
- After scaffold, mage_setup prompts to run mage_add_stores_from_file
if stores.json is non-empty (skippable with N).
src/_info.sh — added help entries for `add store` and `add stores`
src/_mage.sh — added dispatch cases for `add store` and `add stores`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds interactive and batch workflows for creating Magento 2 store views under a Valet local development environment.
New commands:
mage add store — interactive: prompts for code, name, domain, locale;
creates the store view via dev/tools/create-store.php,
sets base URLs, updates .valet-env.php, and runs
valet link + valet secure in one step.
mage add stores — batch: reads dev/tools/stores.json and creates all
defined store views non-interactively; batches all
valet link calls then all valet secure calls to avoid
redundant nginx restarts.
stores.json schema (project-agnostic — domain derived from project name):
{
"stores": [
{ "code": "nl_nl", "name": "Dutch", "suffix": "nl", "locale": "nl_NL" }
]
}
Changes:
src/_multistore.sh (new)
- mage_valet_env_add_entry: appends a store entry to .valet-env.php using Python 3; skips duplicates safely.
- mage_add_store: single-store interactive flow with auto-lowercase of store code and input validation.
- mage_add_stores_from_file: batch flow; resolves stores.json from dev/tools/ -> project root -> mage bin dir; computes domain as - so stores.json is project-agnostic.
src/_setup.sh
- Removed hardcoded placeholder store-2 / default2 from mage_setup.
- mage_setup now scaffolds dev/tools/create-store.php and dev/tools/stores.json from the mage bin directory into every new project automatically.
- After scaffold, mage_setup prompts to run mage_add_stores_from_file if stores.json is non-empty (skippable with N).
src/_info.sh — added help entries for
add storeandadd storessrc/_mage.sh — added dispatch cases for
add storeandadd stores